package com.yjhb.android.sbz.entity;

import com.google.gson.Gson;
import com.jojo.android.zxlib.base.BaseEntity;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.Date;

/**
 * 创建者 zx
 * 创建时间 2020/12/4 15:17
 */
public class BalanceDetailed extends BaseEntity {
    /**
     * id : 34
     * userId : 5
     * source : 2
     * target : 1
     * type : 2
     * money : 482
     * remark : 新增
     * createTime : 2020-11-26 08:47:11
     * tag : 203
     */

    private int id;
    private int userId;
    private int source;
    private int target;
    private int type;
    private String money;
    private String remark;
    private Date createTime;
    private int status;
    private int tag;
    /**
     * 当扣款原因与任务相关时，需记录任务id
     */
    private Integer taskId;

    /**
     * 当扣款原因与任务相关时，需记录任务名称
     */
    private String taskName;

    public static BalanceDetailed objectFromData(String str) {

        return new Gson().fromJson(str, BalanceDetailed.class);
    }

    public static BalanceDetailed objectFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);

            return new Gson().fromJson(jsonObject.getString(str), BalanceDetailed.class);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    public static String Tag(int tag) {
        String tagString = "";
        switch (tag) {
            case 101:
                tagString = "发布悬赏扣款";
                break;
            case 102:
                tagString = "提高赏金扣款";
                break;
            case 103:
                tagString = "补充单子数量";
                break;
            case 110:
                tagString = "购买刷新包扣款";
                break;
            case 111:
                tagString = "首页竞价扣款";
                break;
            case 112:
                tagString = "支付宝提现";
                break;
            case 113:
                tagString = "微信提现";
                break;
            case 201:
                tagString = "微信充值";
                break;
            case 202:
                tagString = "支付宝充值";
                break;
            case 203:
                tagString = "悬赏赚取";
                break;
            case 204:
                tagString = "首页竞价失败退款";
                break;

        }
        return tagString;
    }

    public Integer getTaskId() {
        return taskId;
    }

    public void setTaskId(Integer taskId) {
        this.taskId = taskId;
    }

    public String getTaskName() {
        return taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public int getSource() {
        return source;
    }

    public void setSource(int source) {
        this.source = source;
    }

    public int getTarget() {
        return target;
    }

    public void setTarget(int target) {
        this.target = target;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getMoney() {
        return money;
    }

    public void setMoney(String money) {
        this.money = money;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public int getTag() {
        return tag;
    }

    public void setTag(int tag) {
        this.tag = tag;
    }


}
